pub fn str_str(haystack: String, needle: String) -> i32 {
    let needle_len = needle.len();
    if needle_len > haystack.len() {
        return -1;
    }
    let end = haystack.len() - needle.len();
    for i in 0..=end {
        if &haystack[i..i + needle_len] == &needle {
            return i as i32;
        }
    }
    return -1;
}

pub fn str_str_2(haystack: String, needle: String) -> i32 {
    return match haystack.find(&needle) {
        Some(i) => i as i32,
        None => -1,
    };
}
